﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace market
{
    public partial class orderPrint : System.Web.UI.Page
    {
        CommonClass ccObj = new CommonClass();
        DBClass dbObj = new DBClass();
        protected DataRowCollection OrderItems = null;
        public static OrderProperty order = new OrderProperty();
        protected void Page_Load(object sender, EventArgs e)
        {
            order = GetOrderInfo();
        }
        public string GetStatus(int IntOrderID)
        {
            string strSql = "select (case IsConfirm when '0' then '未确认' when '1' then '已确认' end ) as IsConfirm";
            strSql += ",(case IsSend when '0' then '未发货' when '1' then '已发货' end ) as IsSend";
            strSql += "  from OrderInfo where OrderID=" + IntOrderID;
            DataTable dsTable = dbObj.GetDataSetStr(strSql, "tbOI");
            return (dsTable.Rows[0][0].ToString() + "|" + dsTable.Rows[0][1].ToString());
        }
        public string GetHotPrice(string strHotPrice)
        {
            return ccObj.VarStr(strHotPrice, 2);
        }
        //绑定商品总费用
        public string GetTotailPrice(string strTotailPrice)
        {
            return ccObj.VarStr(strTotailPrice, 2);
        }
        public OrderProperty GetOrderInfo()
        {
            string strSql = "select * from OrderInfo where OrderID=" + Convert.ToInt32(Request["OrderID"].Trim());
            DataTable dsTable = dbObj.GetDataSetStr(strSql, "tbOI");
            order.OrderNo = Convert.ToInt32(Request["OrderID"].Trim());
            order.OrderTime = Convert.ToDateTime(dsTable.Rows[0]["OrderDate"].ToString());
            order.ProductPrice = float.Parse(dsTable.Rows[0]["OrderTotal"].ToString());
            order.ShipPrice = float.Parse(dsTable.Rows[0]["FreightFare"].ToString());
            order.TotalPrice = float.Parse(dsTable.Rows[0]["TotalPrice"].ToString());
            order.ShipType = dsTable.Rows[0]["ShipType"].ToString();
            order.ReceiverAddress = dsTable.Rows[0]["ReceiverAddress"].ToString();
            order.ReceiverEmail = dsTable.Rows[0]["ReceiverEmail"].ToString();
            order.ReceiverName = dsTable.Rows[0]["ReceiverName"].ToString();
            order.ReceiverPhone = dsTable.Rows[0]["ReceiverPhone"].ToString();
            order.ReceiverPostcode = dsTable.Rows[0]["ReceiverPostcode"].ToString();
            order.ShipType = dsTable.Rows[0]["ShipType"].ToString();
            return (order);
        }
    }
}